<?php
/**
 * Created by PhpStorm.
 * User: 10838
 * Date: 2017/11/14
 * Time: 11:02
 */
namespace mg_api;


class Mg_api {


    public function api($data){

        /*if($key == "isTrue"){
            //返回值：
           // 1、电话号码存在：{"Status":true,"Message":"该电话号码存在。","JData":null}
            // 2、电话号码存在：{"Status":true,"Message":"该电话号码不存在，请注册。","JData":null}
            //3、其他返回：{"Status":false,"Message":"请输入正确的参数。","JData":null}
            $data = [
              'key'=>$key,
                'F_Tel'=>$tel
            ];
        }
        if($key == "Get_LinkMan"){
            //获取用户资料
            $data = [
                'key'=>$key,
                'F_Tel'=>$openid
            ];
        }
        if($key == "Get_hbgw"){
            //获取获取岗位信息
            $data = [
                'key'=>$key,
            ];
        }
        if($key == "bind_LinkMan"){
            //档案绑定
            $data = [
                'key'=>$key,
                'F_Tel'=>$tel,
                'wx_openid'=>$openid
            ];
        }
        if($key == "Get_cmpList"){
            $data =[
                'key'=>$key,
                'Keyword'=>$keyword
            ];
        }
        //获取用户总积分
        if($key == "Get_LinkMan_Point"){
            $data = [
                'key'=>$key,
                'wx_openid'=>$openid
            ];
        }
        //获取积分明细
        if($key == "Get_LinkMan_PointList"){
            $data = [
                'key'=>$key,
                'wx_openid'=>$openid
            ];
        }*/

        //$url = "http://mj.hotrunkj.com/Api/Link/api.aspx";
        $url = 'https://app.mjssj.com/comToUrl.aspx?joinurl=/Api/Link/api.aspx';
        //初始化
        $ch = curl_init();
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        //设置请求地址
        curl_setopt($ch,CURLOPT_URL,$url);
        //捕获内容但不输出
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

        //模拟post发送
        curl_setopt($ch,CURLOPT_POST,1);
        curl_setopt($ch,CURLOPT_POSTFIELDS,$data);

        //执行
        $re = curl_exec($ch);

        //判断是否发送成功
        if($re == false){
            echo curl_error($ch);
        }else{
            return $re;
        }
        //关闭
        curl_close($ch);

    }
}